
import socket
import threading
import time

udp_socket = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)



def main():

    udp_socket.bind(("",7890))

    dest_ip = input(" target ip : ")
    deset_port = int(input(" target port :"))

    t_recv = threading.Thread(target=recv_msg)
    t_send = threading.Thread(target=send_msg,args=(dest_ip,deset_port))
    t_recv.start()
    t_send.start()

def recv_msg():

    while True:
        recv_data = udp_socket.recvfrom(1024)
        print(recv_data)

def send_msg(dest_ip,deset_port):

    while True:
        send_data = input(" message content :")
        udp_socket.sendto(send_data.encode("utf-8"),(dest_ip,deset_port))


if __name__ == '__main__':
    main()
